WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::ProcessorMotion Class Referenceabstract

Base class of motion processors: they integrate motion data into the robot state. More...

#include <core/processor/processor_motion.h>

Inheritance diagram for wolf::ProcessorMotion:
[legend]

Public Types

enum  ProcessingStep {
  FIRST_TIME_WITHOUT_KF , FIRST_TIME_WITH_KF_BEFORE_INCOMING , FIRST_TIME_WITH_KF_ON_INCOMING , FIRST_TIME_WITH_KF_AFTER_INCOMING ,
  RUNNING_WITHOUT_KF , RUNNING_WITH_KF_BEFORE_ORIGIN , RUNNING_WITH_KF_ON_ORIGIN , RUNNING_WITH_KF_AFTER_ORIGIN
}
 Processing step, depending on whether the origin is set and on the time stamp of the received keyframe. More...
 

Public Member Functions

 ProcessorMotion (const std::string &_type, TypeComposite _state_types, SizeEigen _state_size, SizeEigen _delta_size, SizeEigen _delta_cov_size, SizeEigen _data_size, SizeEigen _calib_size, const YAML::Node &_params)
 Constructor from the derived class name, the state types, the sizes of the state, delta, delta covariance, data and calibration vectors, and the YAML parameters. More...
 
 ~ProcessorMotion () override
 
virtual void resetDerived ()
 Resets the derived class (empty by default) More...
 
TimeStamp getTimeStamp () const override
 Returns the time stamp of the last motion. More...
 
VectorComposite getState (StateKeys _keys="") const override
 Returns the state at the time stamp of the last motion. More...
 
VectorComposite getState (const TimeStamp &_ts, StateKeys _keys="") const override
 Returns the state at a time stamp. More...
 
const Eigen::MatrixXd getCurrentDeltaPreintCov () const
 Gets the delta preintegrated covariance from all integrations so far. More...
 
Motion getMotion () const
 Provide the motion integrated so far. More...
 
Motion getMotion (const TimeStamp &_ts) const
 Provide the motion integrated until a given timestamp. More...
 
CaptureMotionConstPtr findCaptureContainingTimeStamp (const TimeStamp &_ts) const
 Finds the capture whose buffer is the closest to _ts, and checks the time tolerance afterwards. More...
 
CaptureMotionPtr findCaptureContainingTimeStamp (const TimeStamp &_ts)
 Non-const version of findCaptureContainingTimeStamp() (nullptr if none) More...
 
void setOrigin (FrameBasePtr _origin_frame)
 Sets the origin of the motion: a keyframe (zero states are emplaced for its missing keys) More...
 
FrameBasePtr setOrigin (const VectorComposite &_x_origin, const TimeStamp &_ts_origin)
 Sets the origin of the motion: a new keyframe with the given state and time stamp (returned) More...
 
MotionBuffer & getBuffer ()
 Returns the motion buffer of the last capture. More...
 
const MotionBuffer & getBuffer () const
 Returns the motion buffer of the last capture. More...
 
virtual void computeCurrentDelta (const Eigen::VectorXd &_data, const Eigen::MatrixXd &_data_cov, const Eigen::VectorXd &_calib, const double _dt, Eigen::VectorXd &_delta, Eigen::MatrixXd &_delta_cov, Eigen::MatrixXd &_jacobian_calib) const =0
 Converts raw CaptureMotion data to the delta-state format. More...
 
virtual void deltaPlusDelta (const Eigen::VectorXd &_delta1, const Eigen::VectorXd &_delta2, const double _dt2, Eigen::VectorXd &_delta1_plus_delta2) const =0
 Composes a delta-state on top of another delta-state. More...
 
virtual void deltaPlusDelta (const Eigen::VectorXd &_delta1, const Eigen::VectorXd &_delta2, const double _dt2, Eigen::VectorXd &_delta1_plus_delta2, Eigen::MatrixXd &_jacobian1, Eigen::MatrixXd &_jacobian2) const =0
 Composes a delta-state on top of another delta-state, and computes the Jacobians. More...
 
virtual void statePlusDelta (const VectorComposite &_x, const Eigen::VectorXd &_delta, const double _dt, VectorComposite &_x_plus_delta) const =0
 Composes a delta-state on top of a state. More...
 
virtual Eigen::VectorXd deltaZero () const =0
 Returns the zero delta: the delta state equivalent to the null motion. More...
 
virtual Eigen::VectorXd correctDelta (const Eigen::VectorXd &delta_preint, const Eigen::VectorXd &delta_step) const =0
 Corrects the preintegrated delta. More...
 
void mergeCaptures (CaptureMotionPtr cap_prev, CaptureMotionPtr cap_target)
 Merges two consecutive capture motions into the second one. More...
 
virtual Eigen::VectorXd getCalibration (const CaptureBaseConstPtr _capture=nullptr) const =0
 Returns the calibration parameters of a capture (or of the sensor if nullptr) More...
 
bool hasCalibration () const
 Returns whether the motion has calibration parameters. More...
 
CaptureMotionConstPtr getOrigin () const
 Returns the origin capture: the capture of the last keyframe. More...
 
CaptureMotionConstPtr getLast () const
 Returns the last capture: the one integrating the motion since the origin. More...
 
CaptureMotionConstPtr getIncoming () const
 Returns the incoming capture being processed. More...
 
CaptureMotionPtr getOrigin ()
 Returns the origin capture: the capture of the last keyframe. More...
 
CaptureMotionPtr getLast ()
 Returns the last capture: the one integrating the motion since the origin. More...
 
CaptureMotionPtr getIncoming ()
 Returns the incoming capture being processed. More...
 
Eigen::MatrixXd getUnmeasuredPerturbationCov () const
 Returns the covariance of the unmeasured degrees of freedom (to avoid singularity) More...
 
double getMaxTimeSpan () const
 Returns the maximum time span of the buffer to vote for a keyframe. More...
 
double getMaxBuffLength () const
 Returns the maximum length of the buffer to vote for a keyframe. More...
 
double getMaxDistTraveled () const
 Returns the maximum distance traveled to vote for a keyframe. More...
 
double getMaxAngleTurned () const
 Returns the maximum angle turned to vote for a keyframe. More...
 
void setMaxTimeSpan (const double &_max_time_span)
 Sets the maximum time span of the buffer to vote for a keyframe. More...
 
void setMaxBuffLength (const double &_max_buff_length)
 Sets the maximum length of the buffer to vote for a keyframe. More...
 
void setMaxDistTraveled (const double &_max_dist_traveled)
 Sets the maximum distance traveled to vote for a keyframe. More...
 
void setMaxAngleTurned (const double &_max_angle_turned)
 Sets the maximum angle turned to vote for a keyframe. More...
 
void printHeader (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const override
 Prints the information of this node (not of its children) More...
 
- Public Member Functions inherited from wolf::ProcessorBase
void startCaptureProfiling ()
 Starts the profiling of a capture processing. More...
 
void stopCaptureProfiling ()
 Stops the profiling of a capture processing. More...
 
void startKFProfiling ()
 Starts the profiling of a keyframe processing. More...
 
void stopKFProfiling ()
 Stops the profiling of a keyframe processing. More...
 
virtual void printProfiling (std::ostream &stream=std::cout) const
 Prints the profiling of the capture and keyframe processing. More...
 
 ProcessorBase (const std::string &_type, const TypeComposite &_state_types, const YAML::Node &_params)
 Constructor. More...
 
 ~ProcessorBase () override
 
virtual void configure (SensorBasePtr _sensor)=0
 Configures the processor once linked to its sensor. More...
 
virtual void remove ()
 Removes the processor from its sensor (and from the motion providers of the problem) More...
 
bool hasChildren () const override
 Returns whether the node has children in the Wolf tree. More...
 
const TypeComposite & getStateTypes () const
 Returns the state types of the frames created or used by this processor. More...
 
StateKeys getStateKeys () const
 Returns the state keys of the frames created or used by this processor. More...
 
unsigned int id () const
 Returns the processor id. More...
 
void keyFrameCallback (FrameBasePtr _keyframe)
 Notifies a new keyframe (created by another processor) More...
 
void captureCallback (CaptureBasePtr _capture)
 Notifies a new capture. More...
 
SensorBaseConstPtr getSensor () const
 Returns the sensor the processor belongs to. More...
 
SensorBasePtr getSensor ()
 Returns the sensor the processor belongs to. More...
 
YAML::Node getParams () const
 Returns a copy of the YAML parameters. More...
 
bool isMotionProvider () const
 Returns whether the processor is a MotionProvider. More...
 
bool applyLossFunction () const
 Returns whether the factors created by the processor apply a loss function. More...
 
bool isVotingActive () const
 Returns whether the processor can vote for keyframes. More...
 
double getTimeTolerance () const
 Returns the time tolerance to associate time stamps. More...
 
void setApplyLossFunction (bool _apply_loss_function)
 Sets whether the factors created by the processor apply a loss function. More...
 
void setVotingActive (bool _voting_active)
 Sets whether the processor can vote for keyframes. More...
 
void setTimeTolerance (double _time_tolerance)
 Sets the time tolerance to associate time stamps. More...
 
void setDebugVerboseLevel (const std::string &_debug_verbose_level)
 Sets the debug verbosity level: "none", "derived", "base" or "all". More...
 
std::string getDebugVerboseLevel () const
 Returns the debug verbosity level. More...
 
bool checkTimeTolerance (const TimeStamp &_ts1, const TimeStamp &_ts2) const
 Returns whether two time stamps are within the time tolerance. More...
 
bool checkTimeTolerance (const CaptureBasePtr _cap, const TimeStamp &_ts) const
 Returns whether the capture and a time stamp are within the time tolerance. More...
 
bool checkTimeTolerance (const FrameBasePtr _frm, const TimeStamp &_ts) const
 Returns whether the frame and a time stamp are within the time tolerance. More...
 
bool checkTimeTolerance (const FrameBasePtr _frm, const CaptureBasePtr _cap) const
 Returns whether the frame and the capture are within the time tolerance. More...
 
virtual void link (SensorBasePtr) final
 Links the processor to a sensor. More...
 
virtual void printHeader (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
 Prints the information of this node (not of its children) More...
 
void print (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
 Prints this node and, depending on the depth, its children. More...
 
virtual CheckLog localCheck (bool _verbose, std::ostream &_stream, std::string _tabs="") const
 Checks the consistency of this node (not of its children) More...
 
bool check (CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
 Checks the consistency of this node and its children, composing the log. More...
 
- Public Member Functions inherited from wolf::NodeBase
 NodeBase (const std::string &_category, const std::string &_type="Undefined", const std::string &_name="")
 Constructor. More...
 
virtual ~NodeBase ()=default
 Destructor. More...
 
unsigned int nodeId () const
 Returns the node id, unique over the whole Wolf tree. More...
 
std::string getCategory () const
 Returns the category of the node. More...
 
std::string getType () const
 Returns the type (subcategory) of the node. More...
 
std::string getName () const
 Returns the name of the node. More...
 
bool isRemoving () const
 Returns whether the node is being removed. More...
 
virtual bool hasChildren () const =0
 Returns whether the node has children in the Wolf tree. More...
 
void setType (const std::string &_type)
 Sets the type (subcategory) of the node. More...
 
void setName (const std::string &_name)
 Sets the name of the node. More...
 
ProblemConstPtr getProblem () const
 Returns the problem the node belongs to. More...
 
ProblemPtr getProblem ()
 Returns the problem the node belongs to. More...
 
- Public Member Functions inherited from wolf::MotionProvider
 MotionProvider (const TypeComposite &_state_types, const YAML::Node &_params)
 Constructor. More...
 
virtual ~MotionProvider ()
 Destructor. More...
 
virtual TimeStamp getTimeStamp () const =0
 Returns the time stamp of the last motion. More...
 
virtual VectorComposite getState (StateKeys _keys="") const =0
 Returns the state at the time stamp of the last motion. More...
 
virtual VectorComposite getState (const TimeStamp &_ts, StateKeys _keys="") const =0
 Returns the state at a time stamp. More...
 
VectorComposite getOdometry () const
 Returns the odometry. More...
 
void setOdometry (const VectorComposite &)
 Sets the odometry (all the keys of the motion provider are required) More...
 
bool isStateProvider () const
 Returns whether the motion provider is configured as a state provider. More...
 
unsigned int getOrder () const
 Returns the order of the state provider to be used by the problem. Throws if not a state provider. More...
 
void setOrder (unsigned int)
 Sets the order of the state provider to be used by the problem. Throws if not a state provider. More...
 

Protected Member Functions

void processCapture (CaptureBasePtr) override
 Processes an incoming capture: integrates its motion data and, if a keyframe is received or voted, splits the buffer and emplaces the motion factors. More...
 
void processKeyFrame (FrameBasePtr _keyframe_ptr) override
 Does nothing: the ProcessorMotion only processes incoming captures (it is not called) More...
 
bool triggerInCapture (CaptureBasePtr) const override
 Returns true: all incoming captures are processed. More...
 
bool triggerInKeyFrame (FrameBasePtr _keyframe_ptr) const override
 Returns false: the ProcessorMotion only processes incoming captures. More...
 
bool storeKeyFrame (FrameBasePtr) override
 Returns true: all the received keyframes are stored. More...
 
bool storeCapture (CaptureBasePtr) override
 Returns false: the captures are not stored. More...
 
bool voteForKeyFrame () const override
 Votes for keyframe generation. More...
 
double updateDt ()
 Updates and returns the time step between the incoming capture and the last motion of the buffer. More...
 
void integrateOneStep ()
 Makes one step of motion integration. More...
 
void reintegrateBuffer (CaptureMotionPtr _capture_ptr) const
 Reintegrates the motion buffer of a capture with its calibration parameters. More...
 
void splitBuffer (const wolf::CaptureMotionPtr &capture_source, const TimeStamp ts_split, const wolf::CaptureMotionPtr &capture_target) const
 Splits the motion buffer of capture_source at ts_split: the motions before go to capture_target, and both buffers are reintegrated. More...
 
virtual void preProcess ()
 Pre-processes the incoming capture. More...
 
virtual void bootstrap ()
 Bootstraps the processor with some initialization steps. More...
 
virtual void postProcess ()
 Post-processes the incoming capture. More...
 
FrameBasePtr computeProcessingStep ()
 Computes the processing step (see ProcessingStep) and returns the keyframe received (nullptr if none) More...
 
void assertsCaptureMotion (CaptureMotionPtr _capture, std::string error_prefix) const
 Asserts that the capture is valid: not null, with a non-empty buffer whose first motion is zero. More...
 
virtual CaptureMotionPtr emplaceCapture (const FrameBasePtr &_frame_own, const SensorBasePtr &_sensor, const TimeStamp &_ts, const Eigen::VectorXd &_data, const Eigen::MatrixXd &_data_cov, const Eigen::VectorXd &_calib, const Eigen::VectorXd &_calib_preint, const CaptureBasePtr &_capture_origin_ptr)=0
 Emplaces a CaptureMotion. More...
 
virtual void emplaceFeaturesAndFactors (CaptureBasePtr _capture_origin, CaptureMotionPtr _capture_own)=0
 Emplaces the features and factors corresponding to the given capture and links them to it. More...
 
virtual void setCalibration (const CaptureBasePtr _capture, const Eigen::VectorXd &_calibration)=0
 Sets the calibration parameters to the state blocks of a capture. More...
 
Motion motionZero (const TimeStamp &_ts) const
 Returns a zero motion at a time stamp. More...
 
- Protected Member Functions inherited from wolf::ProcessorBase
virtual void processCapture (CaptureBasePtr)=0
 Processes an incoming capture. More...
 
virtual void processKeyFrame (FrameBasePtr _keyframe_ptr)=0
 Processes an incoming keyframe. More...
 
virtual bool triggerInCapture (CaptureBasePtr) const =0
 Returns whether processCapture() should be called after the provided capture arrived. More...
 
virtual bool triggerInKeyFrame (FrameBasePtr) const =0
 Returns whether processKeyFrame() should be called after the provided keyframe arrived. More...
 
virtual bool storeKeyFrame (FrameBasePtr)=0
 Returns whether the provided keyframe should be stored in buffer_frame_. More...
 
virtual bool storeCapture (CaptureBasePtr)=0
 Returns whether the provided capture should be stored in buffer_capture_. More...
 
virtual bool voteForKeyFrame () const =0
 Votes for keyframe generation. More...
 
virtual bool permittedKeyFrame () const final
 Returns whether this processor can create a keyframe: voting is active and the problem permits it. More...
 
void setProblem (ProblemPtr) override
 Sets the problem, adding the state types to it and, if it is a state provider, the processor as motion provider. More...
 
void addTypes (const TypeComposite &)
 Adds the provided state types to the processor and to the problem (if set). Throws if a key already has a different type. More...
 
virtual void setProblem (ProblemPtr _prob_ptr)
 Sets the problem the node belongs to. More...
 
- Protected Member Functions inherited from wolf::MotionProvider
void addTypes (const TypeComposite &_state_types)
 Adds the types of the states provided (with identity odometry). Throws if a key already has a different type. More...
 

Protected Attributes

ProcessingStep processing_step_
 State machine controlling the processing step. More...
 
bool bootstrapping_
 Processor is bootstrapping. More...
 
SizeEigen x_size_
 The size of the state vector. More...
 
SizeEigen data_size_
 The size of the incoming data. More...
 
SizeEigen delta_size_
 The size of the deltas. More...
 
SizeEigen delta_cov_size_
 The size of the delta covariances matrix. More...
 
SizeEigen calib_size_
 The size of the calibration parameters (TBD in derived classes) More...
 
CaptureMotionPtr origin_ptr_
 Origin capture: the capture of the last keyframe. More...
 
CaptureMotionPtr last_ptr_
 Last capture: the one integrating the motion since the origin. More...
 
CaptureMotionPtr incoming_ptr_
 Incoming capture being processed. More...
 
double dt_
 Time step. More...
 
Eigen::VectorXd x_
 Current state. More...
 
Eigen::VectorXd delta_
 Current delta. More...
 
Eigen::MatrixXd delta_cov_
 Current delta covariance. More...
 
Eigen::VectorXd delta_integrated_
 Integrated delta. More...
 
Eigen::MatrixXd delta_integrated_cov_
 Integrated delta covariance. More...
 
Eigen::VectorXd calib_preint_
 Calibration vector used during pre-integration. More...
 
Eigen::MatrixXd jacobian_delta_preint_
 Jacobian of delta composition w.r.t previous delta integrated. More...
 
Eigen::MatrixXd jacobian_delta_
 Jacobian of delta composition w.r.t current delta. More...
 
Eigen::MatrixXd jacobian_calib_
 Jacobian of delta preintegration wrt calibration params. More...
 
Eigen::MatrixXd jacobian_delta_calib_
 Jacobian of delta wrt calib params. More...
 
Eigen::MatrixXd unmeasured_perturbation_cov_
 Covariance of unmeasured DoF to avoid singularity. More...
 
- Protected Attributes inherited from wolf::ProcessorBase
unsigned int processor_id_
 Processor id, unique among processors. More...
 
YAML::Node params_
 YAML parameters. More...
 
BufferFrame buffer_frame_
 Buffer of the received keyframes to be processed. More...
 
BufferCapture buffer_capture_
 Buffer of the received captures to be processed. More...
 
std::string debug_verbose_level_
 Debug verbosity level: "none", "derived", "base" or "all". More...
 
- Protected Attributes inherited from wolf::NodeBase
ProblemWPtr problem_ptr_
 Problem the node belongs to. More...
 
unsigned int node_id_
 Node id. It is unique over the whole Wolf Tree. More...
 
std::string node_category_
 Text label identifying the category of node ("SENSOR", "FEATURE", etc) More...
 
std::string node_type_
 Type or subcategory of node (derived class name: "SensorOdom2d", etc) More...
 
std::string node_name_
 
bool is_removing_
 A flag for safely removing nodes from the Wolf tree. See remove(). More...
 
- Protected Attributes inherited from wolf::MotionProvider
bool is_state_provider_
 Whether this motion provider is configured as a state provider. More...
 
unsigned int state_provider_order_
 If a state provider, the order to be used by the problem. More...
 

Detailed Description

Base class of motion processors: they integrate motion data into the robot state.

This processor integrates motion data into vehicle states.

The motion data is provided by the sensor owning this processor.

This data is, in the general case, in the reference frame of the sensor:

  • Beware of the frame transformations Map to Robot, and Robot to Sensor, so that your produced motion Factors are correctly expressed.
    • The robot state R is expressed in a global or 'Map' reference frame, named M.
    • The sensor frame S is expressed in the robot frame R.
    • The motion data data_ is expressed in the sensor frame S.
  • You can use three basic methods for this:
    • The trivial: make the sensor frame and the robot frame the same frame, that is, S = Id.
    • Transform incoming data from sensor frame to robot frame, and then integrate motion in robot frame.
    • Integrate motion directly in sensor frame, and transform to robot frame at the time of:

Should you need extra functionality for your derived types, you can overload these two methods,

which are called at the beginning and at the end of processCapture(). See the doc of these functions for more info.

Member Enumeration Documentation

◆ ProcessingStep

Processing step, depending on whether the origin is set and on the time stamp of the received keyframe.

Enumerator
FIRST_TIME_WITHOUT_KF 

Origin not set, no keyframe received.

FIRST_TIME_WITH_KF_BEFORE_INCOMING 

Origin not set, keyframe received before the incoming capture.

FIRST_TIME_WITH_KF_ON_INCOMING 

Origin not set, keyframe received at the incoming capture.

FIRST_TIME_WITH_KF_AFTER_INCOMING 

Origin not set, keyframe received after the incoming capture.

RUNNING_WITHOUT_KF 

Origin set, no keyframe received.

RUNNING_WITH_KF_BEFORE_ORIGIN 

Origin set, keyframe received before the origin.

RUNNING_WITH_KF_ON_ORIGIN 

Origin set, keyframe received at the origin.

RUNNING_WITH_KF_AFTER_ORIGIN 

Origin set, keyframe received after the origin.

Constructor & Destructor Documentation

◆ ProcessorMotion()

wolf::ProcessorMotion::ProcessorMotion ( const std::string &  _type,
TypeComposite  _state_types,
SizeEigen  _state_size,
SizeEigen  _delta_size,
SizeEigen  _delta_cov_size,
SizeEigen  _data_size,
SizeEigen  _calib_size,
const YAML::Node &  _params 
)

Constructor from the derived class name, the state types, the sizes of the state, delta, delta covariance, data and calibration vectors, and the YAML parameters.

◆ ~ProcessorMotion()

wolf::ProcessorMotion::~ProcessorMotion ( )
override

Member Function Documentation

◆ assertsCaptureMotion()

void wolf::ProcessorMotion::assertsCaptureMotion ( CaptureMotionPtr  _capture,
std::string  error_prefix 
) const
protected

Asserts that the capture is valid: not null, with a non-empty buffer whose first motion is zero.

◆ bootstrap()

virtual void wolf::ProcessorMotion::bootstrap ( )
inlineprotectedvirtual

Bootstraps the processor with some initialization steps.

◆ computeCurrentDelta()

virtual void wolf::ProcessorMotion::computeCurrentDelta ( const Eigen::VectorXd &  _data,
const Eigen::MatrixXd &  _data_cov,
const Eigen::VectorXd &  _calib,
const double  _dt,
Eigen::VectorXd &  _delta,
Eigen::MatrixXd &  _delta_cov,
Eigen::MatrixXd &  _jacobian_calib 
) const
pure virtual

Converts raw CaptureMotion data to the delta-state format.

This function accepts raw data and time step dt, and computes the value of the delta-state and its covariance, returned in _delta and _delta_cov.

Parameters
_datameasured motion data
_data_covcovariance
_dttime step
_deltacomputed delta
_delta_covcovariance
_calibcurrent state of the calibrated parameters
_jacobian_calibJacobian of the delta wrt calib

Rationale:

The delta-state format must be compatible for integration using the composition functions doing the math in this class: statePlusDelta() and deltaPlusDelta(). See the class documentation for some Eigen::VectorXd suggestions.

The data format is generally not the same as the delta format, because it is the format of the raw data provided by the Capture, which is unaware of the needs of this processor.

Additionally, sometimes the data format is in the form of a velocity, or a higher derivative, while the delta is in the form of an increment. In such cases, converting from data to delta-state needs integrating the data over the period dt.

Two trivial implementations would establish:

  • If _data is an increment:
     _delta     = _data;
     _delta_cov = _data_cov
    
  • If _data is a velocity:

     _delta     = _data * _dt
     _delta_cov = _data_cov * _dt * _dt.
    

    However, other more complicated relations are possible. In general, we'll have a nonlinear function relating _delta to _data and _dt, as follows:

    _delta = f ( _data, _dt)

The delta covariance is obtained by classical uncertainty propagation of the data covariance, that is, through the Jacobians of f(),

_delta_cov = F_data * _data_cov * F_data.transpose

where F_data = d_f/d_data is the Jacobian of f().

Implemented in wolf::ProcessorDiffDrive, wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

◆ computeProcessingStep()

FrameBasePtr wolf::ProcessorMotion::computeProcessingStep ( )
protected

Computes the processing step (see ProcessingStep) and returns the keyframe received (nullptr if none)

◆ correctDelta()

virtual Eigen::VectorXd wolf::ProcessorMotion::correctDelta ( const Eigen::VectorXd &  delta_preint,
const Eigen::VectorXd &  delta_step 
) const
pure virtual

Corrects the preintegrated delta.

This produces a delta correction according to the appropriate manifold.

Parameters
delta_preintthe preintegrated delta to correct
delta_stepan increment in the tangent space of the manifold

We want to do

delta_corr = delta_preint (+) delta_step

where the operator (+) is the right-plus operator on the delta's manifold.

Note: usually in motion pre-integration we have

delta_step = Jac_delta_calib * (calib - calib_pre)

Implemented in wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

◆ deltaPlusDelta() [1/2]

virtual void wolf::ProcessorMotion::deltaPlusDelta ( const Eigen::VectorXd &  _delta1,
const Eigen::VectorXd &  _delta2,
const double  _dt2,
Eigen::VectorXd &  _delta1_plus_delta2 
) const
pure virtual

Composes a delta-state on top of another delta-state.

Parameters
_delta1the first delta-state
_delta2the second delta-state
_dt2the second delta-state's time delta
_delta1_plus_delta2the delta2 composed on top of delta1. It has the format of delta-state.

This function implements the composition (+) so that _delta1_plus_delta2 = _delta1 (+) _delta2.

Implemented in wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

◆ deltaPlusDelta() [2/2]

virtual void wolf::ProcessorMotion::deltaPlusDelta ( const Eigen::VectorXd &  _delta1,
const Eigen::VectorXd &  _delta2,
const double  _dt2,
Eigen::VectorXd &  _delta1_plus_delta2,
Eigen::MatrixXd &  _jacobian1,
Eigen::MatrixXd &  _jacobian2 
) const
pure virtual

Composes a delta-state on top of another delta-state, and computes the Jacobians.

Parameters
_delta1the first delta-state
_delta2the second delta-state
_dt2the second delta-state's time delta
_delta1_plus_delta2the delta2 composed on top of delta1. It has the format of delta-state.
_jacobian1the jacobian of the composition w.r.t. _delta1.
_jacobian2the jacobian of the composition w.r.t. _delta2.

This function implements the composition (+) so that _delta1_plus_delta2 = _delta1 (+) _delta2 and its jacobians.

Implemented in wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

◆ deltaZero()

virtual Eigen::VectorXd wolf::ProcessorMotion::deltaZero ( ) const
pure virtual

Returns the zero delta: the delta state equivalent to the null motion.

Examples (see documentation of the class for info on Eigen::VectorXd):

  • 2d odometry: a 3-vector with all zeros, e.g. VectorXd::Zero(3)
  • 3d odometry: delta type is a PQ vector: 7-vector with [0,0,0, 0,0,0,1]
  • IMU: PQV 10-vector with [0,0,0, 0,0,0,1, 0,0,0] // No biases in the delta !!

Implemented in wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

◆ emplaceCapture()

virtual CaptureMotionPtr wolf::ProcessorMotion::emplaceCapture ( const FrameBasePtr &  _frame_own,
const SensorBasePtr &  _sensor,
const TimeStamp &  _ts,
const Eigen::VectorXd &  _data,
const Eigen::MatrixXd &  _data_cov,
const Eigen::VectorXd &  _calib,
const Eigen::VectorXd &  _calib_preint,
const CaptureBasePtr &  _capture_origin_ptr 
)
protectedpure virtual

Emplaces a CaptureMotion.

Parameters
_frame_ownframe owning the Capture to create
_sensorSensor that produced the Capture
_tstime stamp
_dataa vector of motion data
_data_covcovariances matrix of the motion data data
_calibcalibration vector
_calib_preintcalibration vector used during pre-integration
_capture_origin_ptrcapture acting as the origin of motions for the MotionBuffer of the created CaptureMotion

Implemented in wolf::ProcessorDiffDrive, wolf::ProcessorOdom3d, and wolf::ProcessorOdom2d.

◆ emplaceFeaturesAndFactors()

virtual void wolf::ProcessorMotion::emplaceFeaturesAndFactors ( CaptureBasePtr  _capture_origin,
CaptureMotionPtr  _capture_own 
)
protectedpure virtual

Emplaces the features and factors corresponding to the given capture and links them to it.

Parameters
_capture_ownthe parent capture
_capture_originthe capture constrained by this motion factor

Typical factors to add for a ProcessorMotionDerived can be:

  • A preintegrated motion factor – this is the main factor
  • A calibration drift factor – only for dynamic sensor calibration parameters
  • An instantaneous factor for observing non-typical states of the Frame – useful for complex dynamic robot models

Implemented in wolf::ProcessorDiffDrive, wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

◆ findCaptureContainingTimeStamp() [1/2]

CaptureMotionPtr wolf::ProcessorMotion::findCaptureContainingTimeStamp ( const TimeStamp &  _ts)

Non-const version of findCaptureContainingTimeStamp() (nullptr if none)

◆ findCaptureContainingTimeStamp() [2/2]

CaptureMotionConstPtr wolf::ProcessorMotion::findCaptureContainingTimeStamp ( const TimeStamp &  _ts) const

Finds the capture whose buffer is the closest to _ts, and checks the time tolerance afterwards.

Only captures with an available origin capture are considered. In case of draw (e.g. _ts at the boundary of two buffers), the newest capture is returned.

Returns
a pointer to the capture (if it exists within time tolerance) or a nullptr (otherwise)

◆ getBuffer() [1/2]

MotionBuffer & wolf::ProcessorMotion::getBuffer ( )
inline

Returns the motion buffer of the last capture.

◆ getBuffer() [2/2]

const MotionBuffer & wolf::ProcessorMotion::getBuffer ( ) const
inline

Returns the motion buffer of the last capture.

◆ getCalibration()

virtual Eigen::VectorXd wolf::ProcessorMotion::getCalibration ( const CaptureBaseConstPtr  _capture = nullptr) const
pure virtual

Returns the calibration parameters of a capture (or of the sensor if nullptr)

Implemented in wolf::ProcessorOdom2d, wolf::ProcessorOdom3d, and wolf::ProcessorDiffDrive.

◆ getCurrentDeltaPreintCov()

const Eigen::MatrixXd wolf::ProcessorMotion::getCurrentDeltaPreintCov ( ) const
inline

Gets the delta preintegrated covariance from all integrations so far.

Returns
the delta preintegrated covariance matrix

◆ getIncoming() [1/2]

CaptureMotionPtr wolf::ProcessorMotion::getIncoming ( )
inline

Returns the incoming capture being processed.

◆ getIncoming() [2/2]

CaptureMotionConstPtr wolf::ProcessorMotion::getIncoming ( ) const
inline

Returns the incoming capture being processed.

◆ getLast() [1/2]

CaptureMotionPtr wolf::ProcessorMotion::getLast ( )
inline

Returns the last capture: the one integrating the motion since the origin.

◆ getLast() [2/2]

CaptureMotionConstPtr wolf::ProcessorMotion::getLast ( ) const
inline

Returns the last capture: the one integrating the motion since the origin.

◆ getMaxAngleTurned()

double wolf::ProcessorMotion::getMaxAngleTurned ( ) const
inline

Returns the maximum angle turned to vote for a keyframe.

◆ getMaxBuffLength()

double wolf::ProcessorMotion::getMaxBuffLength ( ) const
inline

Returns the maximum length of the buffer to vote for a keyframe.

◆ getMaxDistTraveled()

double wolf::ProcessorMotion::getMaxDistTraveled ( ) const
inline

Returns the maximum distance traveled to vote for a keyframe.

◆ getMaxTimeSpan()

double wolf::ProcessorMotion::getMaxTimeSpan ( ) const
inline

Returns the maximum time span of the buffer to vote for a keyframe.

◆ getMotion() [1/2]

Motion wolf::ProcessorMotion::getMotion ( ) const
inline

Provide the motion integrated so far.

Returns
the integrated motion

◆ getMotion() [2/2]

Motion wolf::ProcessorMotion::getMotion ( const TimeStamp &  _ts) const
inline

Provide the motion integrated until a given timestamp.

Returns
the integrated motion

◆ getOrigin() [1/2]

CaptureMotionPtr wolf::ProcessorMotion::getOrigin ( )
inline

Returns the origin capture: the capture of the last keyframe.

◆ getOrigin() [2/2]

CaptureMotionConstPtr wolf::ProcessorMotion::getOrigin ( ) const
inline

Returns the origin capture: the capture of the last keyframe.

◆ getState() [1/2]

VectorComposite wolf::ProcessorMotion::getState ( const TimeStamp &  _ts,
StateKeys  _keys = "" 
) const
overridevirtual

Returns the state at a time stamp.

Parameters
_tsThe time stamp of the state to retrieve
_keysThe keys of the states to retrieve (all keys if empty)

Implements wolf::MotionProvider.

◆ getState() [2/2]

VectorComposite wolf::ProcessorMotion::getState ( StateKeys  _keys = "") const
overridevirtual

Returns the state at the time stamp of the last motion.

Parameters
_keysThe keys of the states to retrieve (all keys if empty)

Implements wolf::MotionProvider.

◆ getTimeStamp()

TimeStamp wolf::ProcessorMotion::getTimeStamp ( ) const
overridevirtual

Returns the time stamp of the last motion.

Implements wolf::MotionProvider.

◆ getUnmeasuredPerturbationCov()

Eigen::MatrixXd wolf::ProcessorMotion::getUnmeasuredPerturbationCov ( ) const
inline

Returns the covariance of the unmeasured degrees of freedom (to avoid singularity)

◆ hasCalibration()

bool wolf::ProcessorMotion::hasCalibration ( ) const
inline

Returns whether the motion has calibration parameters.

◆ integrateOneStep()

void wolf::ProcessorMotion::integrateOneStep ( )
protected

Makes one step of motion integration.

Integrate motion data in incoming_ptr_ and store all results in the MotionBuffer in last_ptr_

◆ mergeCaptures()

void wolf::ProcessorMotion::mergeCaptures ( CaptureMotionPtr  cap_prev,
CaptureMotionPtr  cap_target 
)

Merges two consecutive capture motions into the second one.

The first capture motion is not removed. If the second capture has feature and factor emplaced, they are replaced by new ones.

Parameters
cap_prevthe first capture motion to be merged (input)
cap_targetthe second capture motion (modified)

◆ motionZero()

Motion wolf::ProcessorMotion::motionZero ( const TimeStamp &  _ts) const
inlineprotected

Returns a zero motion at a time stamp.

◆ postProcess()

virtual void wolf::ProcessorMotion::postProcess ( )
inlineprotectedvirtual

Post-processes the incoming capture.

This is called by processCapture() after finishing the processing algorithm.

Overload this function to post-process stuff on derived classes.

Typical uses of postProcess() are:

  • resetting and/or clearing variables and/or algorithms at the end of processing
  • drawing / printing / logging the results of the processing

◆ preProcess()

virtual void wolf::ProcessorMotion::preProcess ( )
inlineprotectedvirtual

Pre-processes the incoming capture.

This is called by processCapture() just after assigning incoming_ptr_ to a valid Capture.

Overload this function to prepare stuff on derived classes.

Typical uses of preProcess() are:

  • casting base types to derived types
  • initializing counters, flags, or any derived variables
  • initializing algorithms needed for processing the derived data

◆ printHeader()

void wolf::ProcessorMotion::printHeader ( int  depth,
bool  factored_by,
bool  metric,
bool  state_blocks,
std::ostream &  stream,
std::string  _tabs = "" 
) const
overridevirtual

Prints the information of this node (not of its children)

Reimplemented from wolf::ProcessorBase.

◆ processCapture()

void wolf::ProcessorMotion::processCapture ( CaptureBasePtr  _incoming_ptr)
overrideprotectedvirtual

Processes an incoming capture: integrates its motion data and, if a keyframe is received or voted, splits the buffer and emplaces the motion factors.

Implements wolf::ProcessorBase.

◆ processKeyFrame()

void wolf::ProcessorMotion::processKeyFrame ( FrameBasePtr  _keyframe_ptr)
inlineoverrideprotectedvirtual

Does nothing: the ProcessorMotion only processes incoming captures (it is not called)

Implements wolf::ProcessorBase.

◆ reintegrateBuffer()

void wolf::ProcessorMotion::reintegrateBuffer ( CaptureMotionPtr  _capture_ptr) const
protected

Reintegrates the motion buffer of a capture with its calibration parameters.

◆ resetDerived()

void wolf::ProcessorMotion::resetDerived ( )
inlinevirtual

Resets the derived class (empty by default)

◆ setCalibration()

virtual void wolf::ProcessorMotion::setCalibration ( const CaptureBasePtr  _capture,
const Eigen::VectorXd &  _calibration 
)
protectedpure virtual

Sets the calibration parameters to the state blocks of a capture.

Implemented in wolf::ProcessorDiffDrive, wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

◆ setMaxAngleTurned()

void wolf::ProcessorMotion::setMaxAngleTurned ( const double &  _max_angle_turned)
inline

Sets the maximum angle turned to vote for a keyframe.

◆ setMaxBuffLength()

void wolf::ProcessorMotion::setMaxBuffLength ( const double &  _max_buff_length)
inline

Sets the maximum length of the buffer to vote for a keyframe.

◆ setMaxDistTraveled()

void wolf::ProcessorMotion::setMaxDistTraveled ( const double &  _max_dist_traveled)
inline

Sets the maximum distance traveled to vote for a keyframe.

◆ setMaxTimeSpan()

void wolf::ProcessorMotion::setMaxTimeSpan ( const double &  _max_time_span)
inline

Sets the maximum time span of the buffer to vote for a keyframe.

◆ setOrigin() [1/2]

FrameBasePtr wolf::ProcessorMotion::setOrigin ( const VectorComposite &  _x_origin,
const TimeStamp &  _ts_origin 
)

Sets the origin of the motion: a new keyframe with the given state and time stamp (returned)

Parameters
_x_originthe state at the origin
_ts_originorigin timestamp.

◆ setOrigin() [2/2]

void wolf::ProcessorMotion::setOrigin ( FrameBasePtr  _origin_frame)

Sets the origin of the motion: a keyframe (zero states are emplaced for its missing keys)

Parameters
_origin_framethe keyframe to be the origin

◆ splitBuffer()

void wolf::ProcessorMotion::splitBuffer ( const wolf::CaptureMotionPtr &  capture_source,
const TimeStamp  ts_split,
const wolf::CaptureMotionPtr &  capture_target 
) const
protected

Splits the motion buffer of capture_source at ts_split: the motions before go to capture_target, and both buffers are reintegrated.

we are doing this:

Before split:

       ts_split

KF | F or KF

  • --------------------—* origin source

After split:

KF KF F or KF

  • -------—* --------—* origin target source

◆ statePlusDelta()

virtual void wolf::ProcessorMotion::statePlusDelta ( const VectorComposite &  _x,
const Eigen::VectorXd &  _delta,
const double  _dt,
VectorComposite &  _x_plus_delta 
) const
pure virtual

Composes a delta-state on top of a state.

Parameters
_xthe initial state
_deltathe delta-state
_x_plus_deltathe updated state. It has the same format as the initial state.
_dtthe time interval spanned by the Delta

This function implements the composition (+) so that _x_plus_delta = _x (+) _delta.

Implemented in wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

◆ storeCapture()

bool wolf::ProcessorMotion::storeCapture ( CaptureBasePtr  )
inlineoverrideprotectedvirtual

Returns false: the captures are not stored.

Implements wolf::ProcessorBase.

◆ storeKeyFrame()

bool wolf::ProcessorMotion::storeKeyFrame ( FrameBasePtr  )
inlineoverrideprotectedvirtual

Returns true: all the received keyframes are stored.

Implements wolf::ProcessorBase.

◆ triggerInCapture()

bool wolf::ProcessorMotion::triggerInCapture ( CaptureBasePtr  ) const
inlineoverrideprotectedvirtual

Returns true: all incoming captures are processed.

Implements wolf::ProcessorBase.

◆ triggerInKeyFrame()

bool wolf::ProcessorMotion::triggerInKeyFrame ( FrameBasePtr  _keyframe_ptr) const
inlineoverrideprotectedvirtual

Returns false: the ProcessorMotion only processes incoming captures.

Implements wolf::ProcessorBase.

◆ updateDt()

double wolf::ProcessorMotion::updateDt ( )
inlineprotected

Updates and returns the time step between the incoming capture and the last motion of the buffer.

◆ voteForKeyFrame()

bool wolf::ProcessorMotion::voteForKeyFrame ( ) const
inlineoverrideprotectedvirtual

Votes for keyframe generation.

If a KeyFrame criterion is validated, this function returns true, meaning that it wants to create a KeyFrame at the last Capture.

WARNING! This function only votes! It does not create KeyFrames!

Implements wolf::ProcessorBase.

Reimplemented in wolf::ProcessorOdom2d, and wolf::ProcessorOdom3d.

Member Data Documentation

◆ bootstrapping_

bool wolf::ProcessorMotion::bootstrapping_
protected

Processor is bootstrapping.

◆ calib_preint_

Eigen::VectorXd wolf::ProcessorMotion::calib_preint_
mutableprotected

Calibration vector used during pre-integration.

◆ calib_size_

SizeEigen wolf::ProcessorMotion::calib_size_
protected

The size of the calibration parameters (TBD in derived classes)

◆ data_size_

SizeEigen wolf::ProcessorMotion::data_size_
protected

The size of the incoming data.

◆ delta_

Eigen::VectorXd wolf::ProcessorMotion::delta_
mutableprotected

Current delta.

◆ delta_cov_

Eigen::MatrixXd wolf::ProcessorMotion::delta_cov_
mutableprotected

Current delta covariance.

◆ delta_cov_size_

SizeEigen wolf::ProcessorMotion::delta_cov_size_
protected

The size of the delta covariances matrix.

◆ delta_integrated_

Eigen::VectorXd wolf::ProcessorMotion::delta_integrated_
mutableprotected

Integrated delta.

◆ delta_integrated_cov_

Eigen::MatrixXd wolf::ProcessorMotion::delta_integrated_cov_
mutableprotected

Integrated delta covariance.

◆ delta_size_

SizeEigen wolf::ProcessorMotion::delta_size_
protected

The size of the deltas.

◆ dt_

double wolf::ProcessorMotion::dt_
mutableprotected

Time step.

◆ incoming_ptr_

CaptureMotionPtr wolf::ProcessorMotion::incoming_ptr_
protected

Incoming capture being processed.

◆ jacobian_calib_

Eigen::MatrixXd wolf::ProcessorMotion::jacobian_calib_
mutableprotected

Jacobian of delta preintegration wrt calibration params.

◆ jacobian_delta_

Eigen::MatrixXd wolf::ProcessorMotion::jacobian_delta_
mutableprotected

Jacobian of delta composition w.r.t current delta.

◆ jacobian_delta_calib_

Eigen::MatrixXd wolf::ProcessorMotion::jacobian_delta_calib_
mutableprotected

Jacobian of delta wrt calib params.

◆ jacobian_delta_preint_

Eigen::MatrixXd wolf::ProcessorMotion::jacobian_delta_preint_
mutableprotected

Jacobian of delta composition w.r.t previous delta integrated.

◆ last_ptr_

CaptureMotionPtr wolf::ProcessorMotion::last_ptr_
protected

Last capture: the one integrating the motion since the origin.

◆ origin_ptr_

CaptureMotionPtr wolf::ProcessorMotion::origin_ptr_
protected

Origin capture: the capture of the last keyframe.

◆ processing_step_

ProcessingStep wolf::ProcessorMotion::processing_step_
protected

State machine controlling the processing step.

◆ unmeasured_perturbation_cov_

Eigen::MatrixXd wolf::ProcessorMotion::unmeasured_perturbation_cov_
protected

Covariance of unmeasured DoF to avoid singularity.

◆ x_

Eigen::VectorXd wolf::ProcessorMotion::x_
mutableprotected

Current state.

◆ x_size_

SizeEigen wolf::ProcessorMotion::x_size_
protected

The size of the state vector.


The documentation for this class was generated from the following files: